package com.example.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.concurrent.TimeUnit;

/**
 * @author Lexin Huang
 * @date 2021/3/20 20:59
 */
@ConfigurationProperties(prefix = "project")
public class ProjectProperties {
    private MailProperties mail;

    private VerificationCode verificationCode;

    private Token token;

    private FileProperties file;

    private InfoProperties userInfo;

    private InfoProperties petInfo;

    private Dynamic dynamic;

    public static class MailProperties {
        private String accountVerificationSubject;

        public String getAccountVerificationSubject() {
            return accountVerificationSubject;
        }

        public void setAccountVerificationSubject(String accountVerificationSubject) {
            this.accountVerificationSubject = accountVerificationSubject;
        }
    }

    public MailProperties getMail() {
        return mail;
    }

    public void setMail(MailProperties mail) {
        this.mail = mail;
    }

    public static class VerificationCode {
        private int len = 8;
        private String defaultCode = "";
        private String cachePrefix = "vfCode#";
        private long timeOut = 5L;
        private TimeUnit timeUnit;
        private String displayUnitName;

        public int getLen() {
            return len;
        }

        public void setLen(int len) {
            this.len = len;
        }

        public String getDefaultCode() {
            return defaultCode;
        }

        public void setDefaultCode(String defaultCode) {
            this.defaultCode = defaultCode;
        }

        public String getCachePrefix() {
            return cachePrefix;
        }

        public void setCachePrefix(String cachePrefix) {
            this.cachePrefix = cachePrefix;
        }

        public long getTimeOut() {
            return timeOut;
        }

        public void setTimeOut(long timeOut) {
            this.timeOut = timeOut;
        }

        public TimeUnit getTimeUnit() {
            return timeUnit;
        }

        public void setTimeUnit(TimeUnit timeUnit) {
            this.timeUnit = timeUnit;
        }

        public String getDisplayUnitName() {
            return displayUnitName;
        }

        public void setDisplayUnitName(String displayUnitName) {
            this.displayUnitName = displayUnitName;
        }
    }

    public VerificationCode getVerificationCode() {
        return verificationCode;
    }

    public void setVerificationCode(VerificationCode verificationCode) {
        this.verificationCode = verificationCode;
    }

    public static class Token {
        private long timeOut;
        private TimeUnit timeUnit;

        public long getTimeOut() {
            return timeOut;
        }

        public void setTimeOut(long timeOut) {
            this.timeOut = timeOut;
        }

        public TimeUnit getTimeUnit() {
            return timeUnit;
        }

        public void setTimeUnit(TimeUnit timeUnit) {
            this.timeUnit = timeUnit;
        }
    }

    public Token getToken() {
        return token;
    }

    public void setToken(Token token) {
        this.token = token;
    }

    public static class FileProperties {
        private String resourcePathSeparator;

        public String getResourcePathSeparator() {
            return resourcePathSeparator;
        }

        public void setResourcePathSeparator(String resourcePathSeparator) {
            this.resourcePathSeparator = resourcePathSeparator;
        }

    }

    public static class Image {
        private String directoryPath;

        private String urlPrefix;

        private String[] supportedTypes;

        public String getDirectoryPath() {
            return directoryPath;
        }

        public void setDirectoryPath(String directoryPath) {
            this.directoryPath = directoryPath;
        }

        public String getUrlPrefix() {
            return urlPrefix;
        }

        public void setUrlPrefix(String urlPrefix) {
            this.urlPrefix = urlPrefix;
        }

        public String[] getSupportedTypes() {
            return supportedTypes;
        }

        public void setSupportedTypes(String[] supportedTypes) {
            this.supportedTypes = supportedTypes;
        }
    }

    public static class Avatar extends Image{
        private String defaultAvatarUrl;

        public String getDefaultAvatarUrl() {
            return defaultAvatarUrl;
        }

        public void setDefaultAvatarUrl(String defaultAvatarUrl) {
            this.defaultAvatarUrl = defaultAvatarUrl;
        }
    }


    public FileProperties getFile() {
        return file;
    }

    public void setFile(FileProperties file) {
        this.file = file;
    }

    public static class InfoProperties {
        private Profile profile;

        private Avatar avatar;

        public Profile getProfile() {
            return profile;
        }

        public void setProfile(Profile profile) {
            this.profile = profile;
        }

        public Avatar getAvatar() {
            return avatar;
        }

        public void setAvatar(Avatar avatar) {
            this.avatar = avatar;
        }
    }

    public static class Profile{
        private String defaultIntroduction;

        public String getDefaultIntroduction() {
            return defaultIntroduction;
        }

        public void setDefaultIntroduction(String defaultIntroduction) {
            this.defaultIntroduction = defaultIntroduction;
        }
    }

    public InfoProperties getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(InfoProperties userInfo) {
        this.userInfo = userInfo;
    }

    public InfoProperties getPetInfo() {
        return petInfo;
    }

    public void setPetInfo(InfoProperties petInfo) {
        this.petInfo = petInfo;
    }

    public static class Dynamic{
        Image image;

        public Image getImage() {
            return image;
        }

        public void setImage(Image image) {
            this.image = image;
        }
    }

    public Dynamic getDynamic() {
        return dynamic;
    }

    public void setDynamic(Dynamic dynamic) {
        this.dynamic = dynamic;
    }
}
